/**
 *
 */
package jp.seraph.same.view.cui;

import jp.seraph.cui.AbstractMode;
import jp.seraph.cui.InternalConsole;
import jp.seraph.cui.Mode;
import jp.seraph.cui.SystemNodeType;
import jp.seraph.jsade.model.JointIdentifierContainer;
import jp.seraph.same.controller.DefaultPoseController;
import jp.seraph.same.controller.PoseController;
import jp.seraph.same.controller.PoseManagerController;
import jp.seraph.same.model.PoseModel;

/**
 *
 */
public class PoseEditMode extends AbstractMode implements Mode {
    public PoseEditMode(Mode aParent, InternalConsole aConsole, PoseManagerController aManagerController, JointIdentifierContainer aIdContainer){
        super(aParent, aConsole);

        mIdContainer = aIdContainer;
        mManagerController = aManagerController;
    }

    private JointIdentifierContainer mIdContainer;
    private PoseManagerController mManagerController;

    /**
     *
     * @see jp.seraph.cui.SystemNode#getName()
     */
    public String getName() {
        return "PoseMode";
    }

    /**
     *
     * @see jp.seraph.cui.SystemNode#setName(java.lang.String)
     */
    public void setName(String aName) {
        // なにもしない
    }

    /**
     *
     * @see jp.seraph.cui.SystemNode#getType()
     */
    public SystemNodeType getType() {
        return PoseEditModeType.getInstance();
    }

    /**
     *
     * @see jp.seraph.cui.SystemNode#isRoot()
     */
    public boolean isRoot() {
        return false;
    }

    public void createPose(String aPoseName){
        String tPoseName = aPoseName;
        Mode tParent = this;

        PoseModel tModel = mManagerController.createPose(tPoseName);
        PoseController tController = new DefaultPoseController(tPoseName, tModel, mManagerController);
        PoseData tNewPose = new PoseData(tPoseName, tModel, tController, tParent, this.getConsole(), mIdContainer);

        tParent.addChild(tNewPose);
    }
}
